#include<vector>
using namespace std;

class CustomStack {
private:
    vector<int> vec_;
    int maxSize_;
    int curIndex_;
public:
    CustomStack(int maxSize) :vec_(maxSize), maxSize_(maxSize), curIndex_(0) {

    }

    void push(int x) {
        if (curIndex_ < maxSize_)
            vec_[curIndex_++] = x;
    }

    int pop() {
        int res = -1;
        if(curIndex_ > 0)
            res=vec_[--curIndex_];
        return res;
    }

    void increment(int k, int val) {
        for (int i = 0; i < k && i < curIndex_; ++i) {
            vec_[i] += val;
        }
    }
};

/**
 * Your CustomStack object will be instantiated and called as such:
 * CustomStack* obj = new CustomStack(maxSize);
 * obj->push(x);
 * int param_2 = obj->pop();
 * obj->increment(k,val);
 */